<?php
class ControllerSAdminModelHeader extends Controller {
	public function index() {
		$this->data['title'] = $this->document->getTitle();
		
		$this->document->addStyle('/theme/stylesheet/business.css');
		$this->document->addScript('/theme/javascript/public.js');
		$this->document->addScript ( 'theme/javascript/jquery-ui.js' );
		$this->document->addStyle ( 'theme/stylesheet/jquery-ui.css');
		$this->document->addStyle(URL_UPLOAD_SERVER_A . 'style/uploadify.css');
		
		$this->document->addScript('/theme/javascript/public.js');
		$this->document->addScript('/theme/javascript/uploadify/jquery.uploadify.js');
		$this->document->addScript('/theme/javascript/jquery.cookie.js');
		$this->document->addScript('/theme/javascript/jquery.json.js');
		$this->document->addScript('/theme/javascript/jquery.baidu-map.js');
		$this->document->addScript('/theme/javascript/jquery-ui-timepicker-addon.js');
		//$this->document->addScript('/theme/javascript/validate/activity_initiate.js');
		
	
		$this->data['base'] = HTTP_SERVER;
		
		$this->load->model('gym/gym');
		$this->load->model('sport/venue');
		
		
		// 分类数据
		$arrOriginData = array(
				'1210' => array( 'url' =>$this->url->link('business/information'),   // 跳转链接
						'func' => 'getGym',   // 方法
						'control' => $this->model_gym_gym ),   // 控制器
				'1130' => array('url' =>$this->url->link('s_admin/info'),
						'func' => 'getVenue' ,
						'control' => $this->model_sport_venue),
		);
		
		$this->data['gym_business_list'] = array();
		$_gym_business = $this->model_gym_gym->getBusiness(array('accountId' => $this->member->getId(), 'status' => 1));
		foreach ($_gym_business as $item)
		{
			if ( isset($arrOriginData[$item['originID']]) ) {
				$_gym_name = $arrOriginData[$item['originID']]['control']->$arrOriginData[$item['originID']]['func']((int)$item['originParameter']);
				if ($_gym_name)
				{
					$this->data['gym_business_list'][] = array(
							'gymID' => $item['originParameter'],
							'href' => $arrOriginData[$item['originID']]['url']."&id=". $item['originParameter'],
							'title' => $_gym_name['name']
					);
				}
			}
		}
		
		// 商家管理 头部 导航..
		
		$this->data['header_nav'] = array(
				array('title' => '首页','url'   => '/'),
				array('title' => '运动','url'   =>$this->url->link('sport/home')),
				array('title' => '健身','url'   => $this->url->link('gym/home')),
				array('title' => '活动','url'   =>$this->url->link('activity/home')),
				array('title' => '微博','url'   =>$this->url->link('user/microblog')),
				array('title' => '圈子','url'   => $this->url->link('circle/home')),
				array('title' => '论坛','url'   => $this->url->link('forum/home')),
				);
		
		$this->data['description'] = $this->document->getDescription();
		$this->data['keywords'] = $this->document->getKeywords();
		$this->data['links'] = $this->document->getLinks();
		$this->data['styles'] = $this->document->getStyles();
		$this->data['scripts'] = $this->document->getScripts();
		
		$this->template = '/template/s_admin/model/header.html';
		
		$this->render();
	}
}
?>